package day03;

import util.杨霸天系列;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;

public class ps extends Frame {
    ArrayList<qq> qqm = new ArrayList<qq>();
    杨霸天系列 a = new 杨霸天系列();
    BufferedImage img;
    public void start(){
        img = a.图片("/image/a.png");
        addMouseListener(new Mouse());  //添加鼠标监听器
        addMouseMotionListener(new Mouse());
        setSize(500,500);
        setVisible(true);
    }

    @Override
    public void update(Graphics g) {
        Image img = createImage(500,500);
        Graphics g1 = img.getGraphics();  //把蒙版上的画笔取出来
        paint(g1);
        g.drawImage(img,0,0,null);
    }

    @Override
    public void paint(Graphics g) {
//        g.fillOval(x,y,50,50);
        g.setColor(new Color(226,174,150,15));
        g.drawImage(img,0,0,500,500,null);
        for (qq o : qqm){
            o.drawSelf(g);
        }
    }
    //鼠标点击的时候，创建一个圈圈出来
    class Mouse extends MouseAdapter{
        @Override
        public void mouseDragged(MouseEvent e) {
            qq o = new qq();
            o.x = e.getX()-25;
            o.y = e.getY()-25;
            qqm.add(o);
            repaint();
        }

    }

    public static void main(String[] args) {
        new ps().start();

    }

}
